<template>
	<view class="">
		<!-- 状态栏 -->
		<view class="status_bar">
		</view>
		<view class="home-index">
			<Tabs></Tabs>
			<view class="info">
				<view class="title">
					统计
				</view>
				<view class="chart">
					<view class="navWrap">
						<view class="nav">
							<view :class="['navItem',activeIndex==0?'active':'']" @click="changeTab(0)">
								周
							</view>
							<view :class="['navItem',activeIndex==1?'active':'']" @click="changeTab(1)">
								月
							</view>
							<view :class="['navItem',activeIndex==2?'active':'']" @click="changeTab(2)">
								半年
							</view>
							<view :class="['navItem',activeIndex==3?'active':'']" @click="changeTab(3)">
								年
							</view>
						</view>
					</view>
					
					<qiun-data-charts type="line" :chartData="chartData" />
				</view>
			</view>
		</view>
	</view>
	
</template>

<script>
	import Tabs from '../../components/tabs.vue'
	export default {
		data() {
			return {
				activeIndex:0,
				chartData:{
				  categories: ["2016", "2017", "2018", "2019", "2020", "2021"],
				  series: [{
				    name: "设备数量",
				    data: [35, 36, 31, 33, 13, 34]
				  }]
				}
			}
		},
		components:{
			Tabs
		},
		methods: {
			changeTab(index){
				this.activeIndex = index;
			}
		}
	}
</script>
<style>
	.status_bar {
		height: var(--status-bar-height);
		width: 100%;
		background-color: #FFFFFF;
	}
</style>
<style lang="less" scoped>
.home-index{
	display: flex;
	height: calc(100vh - var(--status-bar-height));
	.info{
		display: flex;
		flex-direction: column;
		flex:1;
		padding: 0 20px;
		background-color: #D4E7F1;
		.title{
			display: flex;
			align-items: center;
			font-size: 24px;
			color: #235FA7;
			height: 60px;
		}
		.chart{
			display: flex;
			flex-direction: column;
			flex:1;
			// background-color: white;
			margin:30px 0;
			box-shadow: 8px 8px 8px 8px rgba(232,239,247, 0.5);
			.navWrap{
				display: flex;
				flex-direction: row-reverse;
			}
			.nav{
				display: flex;
				width: 50%;
				background-color: red;
				margin: 0 25px;
				background-color: #DCECF4;
				.navItem{
					display: flex;
					justify-content: center;
					align-items: center;
					height: 30px;
					flex:1;
					color: #999999;
				}
				.active{
					color: #4A85BE;
					border:1px solid #4A85BE
				}
			}
		}
	}
	
}
</style>
